package com.StarStudio.Mapper;

import com.StarStudio.Domain.Meteorology;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MeteorologyMapper {

    @Select("select me.* from meteorology me, zone_meteorology zme where me.meteorology_id = zme.meteorology_id and zme.zone_id = #{zoneId} ")
    public List<Meteorology> getAllByZoneId(int zoneId);

    @Select("select me.* from meteorology me, zone_meteorology zme where me.meteorology_id = zme.meteorology_id and zme.zone_id = #{zoneId} order by meteorology_id desc limit 0,1")
    public Meteorology getOneByZoneId(int zoneId);

//    @Insert("insert into meteorology values (null,#{meteorologyTemperature}, #{meteorologyHumidity}, #{meteorologyCo2}, #{meteorologyIlluminance}, #{meteorologyUpdatetime})")
//    @Options(useGeneratedKeys = true)
//    public void add(Meteorology meteorology);
//
//    @Insert("insert into zone_meteorology values(#{zoneId}, #{MeteorologyId})")
//    public void addToZone_Meteorology(@Param("zoneId") int zoneId, @Param("MeteorologyId") int MeteorologyId);
//
//    @Update("update wmy.meteorology set meteorology_temperature=#{meteorologyTemperature},meteorology_humidity=#{meteorologyHumidity},meteorology_co2=#{meteorologyCo2},meteorology_illuminance=#{meteorologyIlluminance},meteorology_updatetime=#{meteorologyUpdatetime} where meteorology_id = #{meteorologyId}")
//    boolean update(Meteorology meteorology);
//
//    @Delete("delete from wmy.meteorology where meteorology_id = #{meteorologyId}")
//    boolean delete(Integer meteorologyId);

}
